package com.rmi;

import java.net.MalformedURLException;
import java.rmi.AlreadyBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

public class Server {
	public static void main(String[] args) throws AlreadyBoundException, RemoteException, MalformedURLException {

		UserManagerImpl userManager = new UserManagerImpl();
		UserManagerInterface userManagerI = (UserManagerInterface) UnicastRemoteObject.exportObject(userManager, 0);
		// Bind the remote object's stub in the registry
		Registry registry = LocateRegistry.createRegistry(2004);


		registry.rebind("userManager", userManagerI);
		System.out.println("server is ready");
	}
}
